package com.changgou.system;


import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
@Component
public class UrlFilter implements GlobalFilter,Ordered {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        System.out.println("第二个拦截器,优先级为2");
        //获取请求的url
        String path = exchange.getRequest().getURI().getPath();
        System.out.println("url:"+path);
        //释放请求
        return chain.filter(exchange);
    }
    @Override
    //拦截器优先级  越小优先级越高
    public int getOrder() {
        return 2;
    }
}
